<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>

	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<title>我的教练</title>

	<!-- 设置网页图标 -->
	<link rel="shortcut icon" href="images/browserLOGO2.png" type="image/x-icon" />
	<link rel="stylesheet" href="bootstrap-4.0.0/dist/css/bootstrap.css">
	<!-- 引用Bootstrap -->
	<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
	<link rel="stylesheet" href="css/fontawesome-all.css">
	<link rel="stylesheet" href="css/owl.theme.css" type="text/css" media="all">
	<link rel="stylesheet" href="css/owl.carousel.css" type="text/css" media="screen" property="" />
	<!-- 网页字体库 -->
	<link href="http://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&amp;subset=devanagari,latin-ext"
	 rel="stylesheet">
	<link href="http://fonts.googleapis.com/css?family=Tangerine:400,700" rel="stylesheet">
	<link href="http://fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i&amp;subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese" rel="stylesheet">
	
	<style type="text/css">
	#dividePage{
	margin-top: 10px;
    margin-bottom: 10px;
    display: inline-block;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 4px;
	}
	
	.pagination>li {
    display: inline;
	}
	
	.pagination>li:first-child>a, .pagination>li:first-child>span {
    margin-left: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
	}
	
	.pagination>li>a, .pagination>li>span {
    position: relative;
    float: left;
    padding: 6px 12px;
    line-height: 1.42857143;
    color: #337ab7;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #ddd;
	}
	
	.myButton{
	background-color:white;
	border-radius:10px;
	}
	
	.myButton:hover {
    background-color:gainsboro;
	}
	
	</style>
</head>
<body>

	<!------------------------------>
	<!------------ 隐藏域  ------------>
	<input type="hidden" id="currentUid" value="${sessionScope.uid }">
	<!------------------------------>

	<div class="main-sec" id="home">
		<!-------------------------------------->
		<!------------ 顶部Logo和导航栏  ------------>
		<!-------------------------------------->
		<%@include file="jsp/header.jsp" %>
		<!-------------------------------------->
		<!-------------------------------------->

		<!-- banner-text -->
		<div class="slider">
			<!-------------------------------->
			<!------------ 顶部轮播图  ------------>
			<!-------------------------------->
			<%@include file="jsp/imageAct.jsp" %>
			<!-------------------------------->
			<!-------------------------------->
			<div class="clearfix"></div>
			<!-- 下滑按钮-->
			<div class="thim-click-to-bottom">
				<div class="rotate">
					<a href="#about" class="scroll" style="width: 100%;">
						<i class="fas fa-angle-double-down"></i>
					</a>
				</div>
			</div>
			<!-- //下滑按钮-->
		</div>
	</div>

<!-- 正文正文正文正文正文正文正文正文正文正文 -->

<div class="container" style="width:80%;margin: auto;margin-top: 20px;margin-bottom: 20px">
	
	<h1 style="margin: 0 0 15px 0;font-size: 24px;color: #ffa000;line-height: 1.3em;padding: 0;font-family: inherit;font-weight: 500;">我的教练</h1>

	<div class="table-responsive" id="CoachList">
		
		<!-- <table class="table table-striped table-hover" style="font-size: 20px;">
			<tr>
				<th>您还没有签约的教练</th>
			</tr>
		</table> -->
	
		<!-- <table class="table table-striped table-hover" style="font-size: 20px;">
			<tr>
			    <th>教练昵称</th>
			    <th>联系方式</th>
			    <th>签约号</th>
			    <th>签约时间</th>
			    <th>操作</th>
			</tr>
			<tr>
			    <td>January</td>
			    <td>$100</td>
			    <td>January</td>
			    <td>$100</td>
			    <td>
			    	<button type="button" class="myButton" title="发起会话">
			    	<img alt="哦豁" src="icon/chat.png">
			    	</button>
			    	<button type="button" class="myButton" title="发起会话">
			    	<img alt="哦豁" src="icon/留言.png">
			    	</button>
			    </td>
			</tr>
			<tr>
			    <td>January</td>
			    <td>$100</td>
			    <td>January</td>
			    <td>$100</td>
			    <td>
			    	<button type="button" class="myButton" title="发起会话">
			    	<img alt="哦豁" src="icon/chat.png">
			    	</button>
			    	<button type="button" class="myButton" title="发起会话">
			    	<img alt="哦豁" src="icon/留言.png">
			    	</button>
			    </td>
			</tr>
			<tr>
			    <td>January</td>
			    <td>$100</td>
			    <td>January</td>
			    <td>$100</td>
			    <td>
			    	<button type="button" class="myButton" title="发起会话">
			    	<img alt="哦豁" src="icon/chat.png">
			    	</button>
			    	<button type="button" class="myButton" title="发起会话">
			    	<img alt="哦豁" src="icon/留言.png">
			    	</button>
			    </td>
			</tr>
		</table>
		
		<div>
			<ul class="pagination" id="dividePage">
			    <li><a href="javascript:void(0)" id="prePage">上一页</a></li>
			    <li><span id="currentPage">1</span><span>/</span><span id="totalPage">2</span></li>
			    <li><a href="javascript:void(0)" id="nextPage">下一页</a></li>
			</ul>
		</div> -->
		
	</div>
</div>



<!-- 正文正文正文正文正文正文正文正文正文正文 -->

		<!-------------------------------------->
		<!------------- 底部Logo和版权  ------------->
		<!-------------------------------------->
		<%@include file="jsp/footer.jsp" %>
		<!-------------------------------------->
		<!-------------------------------------->


	<script src="js/jquery-2.2.3.min.js"></script>
	<script src="js/responsiveslides.min.js"></script>
	<script src="js/owl.carousel.js"></script>
	<script>
		$(function () {
			//轮播图控制
			$("#slider4").responsiveSlides({
				auto: true,
				pager: true,
				nav: false,
				speed: 1000,
				namespace: "callbacks",
				before: function () {
					$('.events').append("<li>before event fired.</li>");
				},
				after: function () {
					$('.events').append("<li>after event fired.</li>");
				}
			});
			
			//显示列表
			showMyCoachList(1);
		});
		
		// 判断登录没有
		if($("#currentUid").val() == null) {
			alert("请先登录！");
			location.href="http://localhost:8080/";
		}
		
		
		//显示当前签约教练列表
		function showMyCoachList(ppage){
			$.ajax({
				url:"myCoach/searchMyCoach",
				type:"post",
				data:{
					uid:$("#currentUid").val(),
					page:ppage
				},
				success:function(data){
					if(data.totalCount==0){         //总数为0代表没有签约教练
						var content="";
						content+='<table class="table table-striped table-hover" style="font-size: 20px;">'
						+'<tr>'
						+'<th>您还没有签约的教练</th>'
						+'</tr>'
						+'</table>';
						$("#CoachList").html(content);
					}else{
						var content2="";
						content2+='<table class="table table-striped table-hover" style="font-size: 20px;">'
							+'<tr>'
							+'<th>教练昵称</th>'
							+'<th>联系方式</th>'
							+'<th>收费</th>'
							+'<th>签约号</th>'
							+'<th>签约时间</th>'
							+'<th>性别</th>'
							+'<th>评分</th>'
							+'<th>认证</th>'
							+'<th>操作</th>'
							+'</tr>';
						for(var i=0;i<data.myCoach.length;i++){
							var po=data.myCoach[i];
							content2+='<tr>'
								+'<td>'+po.nickName+'</td>'
								+'<td>'+po.uphone+'</td>'
								+'<td>'+po.price+'元/小时</td>'
								+'<td>'+po.oid+'</td>'
								+'<td>'+po.createDate+'</td>'
								+'<td>'+po.csex+'</td>'
								+'<td>'+po.cgrade+'</td>'
								+'<td>'+po.authentication+'</td>'
								+'<td>'
								+'<button type="button" class="myButton" title="发起会话">'
								+'<img alt="哦豁" src="icon/chat.png">'
								+'</button>'
								+'<button type="button" class="myButton" title="留言">'
								+'<img alt="哦豁" src="icon/留言.png">'
								+'</button>'
								+'</td>'
								+'</tr>';
						}
						content2+='</table>'
							+'<div>'
							+'<ul class="pagination" id="dividePage">'
							+'<li><a href="javascript:void(0)" id="prePage">上一页</a></li>'
							+'<li><span id="currentPage">1</span><span>/</span><span id="totalPage">1</span></li>'
							+'<li><a href="javascript:void(0)" id="nextPage">下一页</a></li>'
							+'</ul>'
							+'</div>';
						$("#CoachList").html(content2);
						$("#currentPage").html(ppage);
						$("#totalPage").html(data.totalPage);
					}
				}
			});
		}
		
		//下一页
		$("#nextPage").click(function(){
			var currentPage=parseInt($("#currentPage").html());
			var totalPage=parseInt($("#totalPage").html());
			if(currentPage<totalPage){
				showMyCoachList(currentPage+1);
			}
		});
		
		//上一页
		$("#prePage").click(function(){
			var currentPage=parseInt($("#currentPage").html());
			if(currentPage>1){
				showMyCoachList(currentPage-1);
			}
		});
	</script>
	
	<script src="js/SmoothScroll.min.js"></script>
	<!-- 页面跳转至顶部 -->
	<script src="js/move-top.js"></script>
	<script src="js/easing.js"></script>
	<script src="js/skater.js"></script>

	<script src="js/bootstrap.js"></script>
	<script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

</body>
</html>